/* 
 *  javascribd - Java client library for the Scribd API. 
 *  Copyright (C) 2009 by Marcel Eyke, http://code.google.com/p/javascribd/ 
 *  Use is subject to license terms of LGPL. See license.txt. 
 */
package com.google.code.javascribd.connection.jaxbadapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import com.google.code.javascribd.type.DocumentId;

public class DocumentIdAdapter extends XmlAdapter<Integer, DocumentId> {

	@Override
	public Integer marshal(DocumentId documentId) throws Exception {
		if (documentId == null) {
			return null;
		}
		return documentId.intValue();
	}

	@Override
	public DocumentId unmarshal(Integer documentIdInteger) throws Exception {
		if (documentIdInteger == null) {
			return null;
		}
		return new DocumentId(documentIdInteger);
	}
}
